package com.crl.ui.controls
{
	import com.crl.ui.controls.buttons.CheckBox;

	/**
	 * 
	 * @author crl
	 * 
	 */	
	public class CheckBoxGroup
	{
		private var buttons:Array;
		public function CheckBoxGroup()
		{
			buttons=[];
		}
		public function addButton(button:CheckBox):Boolean{
			var index:int=buttons.indexOf(button);
			if(index !=-1)return false;
			
			buttons.push(button);
		}
		
		public function removeButton(button:CheckBox):Boolean{
			var index:int=buttons.indexOf(button);
			if(index ==-1)return false;
			
			buttons.splice(index,1);
		}
		
		public function setSelects(..args):void{
			//todo;
		}
		
		public function getSelects():Vector.<CheckBox>{
			var result:Vector.<CheckBox>=new Vector.<CheckBox>();
			
			for each(var item:CheckBox in buttons){
				if(item.selected)result.push(item);
			}
			return result;
		}
	}
}